package nc.tb.wf.ui;

import org.jgraph.graph.CellView;
import org.jgraph.graph.DefaultCellViewFactory;
import org.jgraph.graph.EdgeView;
import org.jgraph.graph.GraphModel;
import org.jgraph.graph.PortView;
import org.jgraph.graph.VertexView;

public class NtbCellViewFactory extends DefaultCellViewFactory {
	private boolean hasBorder = false;
	public NtbCellViewFactory()
	{
	}
	public NtbCellViewFactory(boolean borderFlag)
	{
		hasBorder = borderFlag;
	}
	
	@Override
	protected VertexView createVertexView(Object cell)
	{
		if (cell instanceof NodeGraph)
		{
			return new StatusNodeVertexView(cell,hasBorder);
		}else
		{
			return super.createVertexView(cell);
		}
		/*else if (model.isEdge(cell))
			view = createEdgeView(cell);*/
	}

	public CellView createView(GraphModel model, Object c)
	{
		return super.createView(model, c);
	}
	@Override
	protected EdgeView createEdgeView(Object cell)
	{
		//return super.createEdgeView(cell);
		return new ActionEdgeView(cell);
	}
	@Override
	protected PortView createPortView(Object cell)
	{
		/*if (cell instanceof Port)
		{
			return new TreeVertexPortView(cell);
		}*/
		return super.createPortView(cell);
	}
}
